#ifndef RG_SAMPLER_H
#define RG_SAMPLER_H

#include "config.h"
#include <cstdlib>
#include <cmath>
using namespace std;

namespace rg{

  //pdf = 1/(y-x)
  inline void uniform1d(real* b,real* e, const real& x=0, const real& y=1){
    real range=y-x;
    while(b!=e)
      *b++=x + rand() * range / RAND_MAX;
  }

  //pdf = cos theta / pi
  inline void cosine_phi(const real* b, const real* e, real* output){
    while(b!=e)
      *output++=acos(sqrt(*b++));
  }

}//namespace rg

#endif
